<!DOCTYPE html>
<html lang="en" ng-app="app">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="js/1.4.8/angular.js"></script>
    <script src="js/1.4.8/angular-route.js"></script>
    <style type="text/css">
        body{
            font-size: 1.5em;
        }
        .div{
            background-color: #2a6496;
            width: 280px;
            padding: 8px;
            color: #fff;
        }
    </style>
</head>
<body>
    <div class="div" ng-controller="myCtrl">
        <span>{{stu.name}}</span>
        <span>{{stu.sex}}</span>
        <span>{{stu.score}}</span>
    </div>
    <script type="application/javascript">
        var app = angular.module("app",[]);
        // 定义服务
        app.config(function ($provide) {
            $provide.factory("outData",[function () {
                var data = {
                    name:"张三",
                    sex:"男",
                    score:"100"
                };
                return data;
            }]);
        });

        app.controller("myCtrl",["$scope","outData",function ($scope,outData) {
            $scope.stu = outData;
        }]);
    </script>
</body>
</html>